<template>
  <div id="cornerComment" v-if="dialogVisible">
    <div class="cornerComment-in" ref="dialogBox">
      <div class="cornerComment-in-title">
        <span>会议录制记录</span>
        <span class="el-icon-circle-close close-Btn-line" @click="closePOpup"></span>
      </div>
      <div class="commentBody">
        <!--本体列表，数据 -->
        <div class="table-body">
          <div class="table-body-box">
            <el-table
                ref="multipleTable"
                :data="arryList"
                :stripe="tableStyle.tableStripe"
                :border="tableStyle.tableBorder"
                tooltip-effect="dark"
                style="width: 100%"
                :height="tableHeight"
                header-cell-class-name="table-text-c"
                cell-class-name="table-text-c">
              <el-table-column
                  label="视频链接"
                  prop="video">
              </el-table-column>
              <el-table-column
                  align="center"
                  prop="create_time"
                  label="操作"
                  width="190">
                <template slot-scope="scope">
                  <el-button size="mini" @click="downs(scope.row)" icon="el-icon-download">下载</el-button>
                  <el-button size="mini" @click="videoSrc=scope.row.video,videoVisible=true"
                             icon="el-icon-video-play">查看
                  </el-button>
                </template>
              </el-table-column>
            </el-table>
          </div>
        </div>
      </div>
      <div class="cornerComment-in-footer">
        <el-button @click="closePOpup" size="small">确定</el-button>
      </div>
    </div>
    <showVideo :visible.sync="videoVisible" :videoSrc="videoSrc"></showVideo>
  </div>
</template>

<script>
import {tableoption} from '@/utils/util.js'
import {videoMeet_detail} from "@/api/admin/videoMeet"
import showVideo from "../floorManage/record/showVideo";
import {mapGetters} from "vuex";

export default {
  props: ['visible', 'meetId'],
  components: {showVideo},
  data() {
    return {
      tableStyle: tableoption,
      dialogVisible: false,
      arryList: [], // 数据列表
      tableHeight: 0,
      meetDetail: null,
      videoVisible: false,
      videoSrc: ''
    }
  },
  computed: {
    ...mapGetters(['configData']),
  },
  watch: {
    visible() {
      let n = this;
      if (this.visible) {
        this.$nextTick(() => {
          let height = n.$refs.dialogBox.offsetHeight;
          n.tableHeight = height - (51 + 20 + 50)
        })
        this.InitFn()
      } else {
        this.arryList = [];
        this.tableHeight = 0
        this.meetDetail =null
      }
      this.dialogVisible = this.visible
    }
  },
  created() {
  },
  methods: {
    // 关闭弹窗
    closePOpup() {
      this.$emit('update:visible', false)
    },
    getJson(option) {
      return JSON.parse(JSON.stringify(option))
    },
    // 初始化
    async InitFn() {
      videoMeet_detail({id: this.meetId}).then(res => {
        this.meetDetail = res.vo
        this.arryList = res.video
      })
    },
    downs(item) {
      let alink = document.createElement("a");
      alink.download = `${this.meetDetail.title}_${item.video}`; // 图片名
      alink.href = `${this.configData.video_url}${item.video}`;
      alink.click();
    },
  },
  mounted() {
  }
}
</script>
<style scoped>
#cornerComment {
  height: 100vh;
  width: 100%;
  position: fixed;
  top: 0;
  left: 0;
  background: rgba(0, 0, 0, .5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9;
}

.cornerComment-in {
  width: 90%;
  height: 80%;
  background: #fff;
  display: flex;
  flex-direction: column;
  border-radius: 5px;
}

.cornerComment-in-title {
  height: 50px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid #ddd;
  font-size: 24px;
}

.cornerComment-in-title span {
  padding: 0 10px;
}

.cornerComment-in-title span:first-child {
  flex: 1;
  font-size: 16px;
}

.cornerComment-in-footer {
  height: 50px;
  border-top: 1px solid #ddd;
  display: flex;
  align-items: center;
  padding: 0 10px;
  justify-content: center;
}

.commentBody {
  padding: 10px 20px;
  flex: 1;
  overflow-y: auto;
}

.close-Btn-line {
  cursor: pointer;
}

.toolbarLine {
  text-align: center;
}

.hearder-search {
  display: flex;
  align-items: center;
}

.breadcrumb-container {
  margin-bottom: 10px;
}
</style>


